package com.aaa.demo11;

/**
 * @author ${崔灿}
 * @date 2022/11/03 19:31
 **/

public class Test02 {
    public static void main(String[] args) {
        Operator o =(arr) -> {
            int sum = 0;
            for(int i : arr){
                sum +=i;
            }
            return sum;
        };

        fun(o);
    }
    public static void fun(Operator operator){
        int sum[] = {11,12,13,14,15,16,17,18,19};
        int sum1 = operator.getSum(sum);
        System.out.println("数组中元素之和为"+sum1);
    }
}
interface Operator{
    //求数组元素的和
    public int getSum(int[] arr);
}